<template>
  <div>
    <el-table :data="roleListData" stripe style="width: 100%" border>
      <el-table-column prop="id" label="角色编号"></el-table-column>
      <el-table-column prop="rolename" label="角色名称"></el-table-column>
      <el-table-column label="状态">
        <template slot-scope="scope">
          <el-button type="primary" @click="onStart(scope.row)">启动</el-button>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary" @click="onChange(scope.row)">编辑</el-button>
          <v-delete @del="del(scope.row.id)"></v-delete>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { roleDel } from "../../../request/api";
export default {
  data() {
    return {};
  },
  props: ["roleListData", "flag"],
  components: {},
  methods: {
    onStart(e) {},
    //点击修改
    onChange(e) {
      this.flag.isShow = true;
      this.flag.isAdd = false;
      this.$emit("reqInfo", e.id);
    },
    //删除
    del(id) {
      roleDel({ id: id }).then(res => {
        if (res.data.code == 200) {
          //重新请求角色列表
          this.$emit("req");
        }
      });
    }
  },
  mounted() {}
};
</script>
<style lang="less" scoped>
</style>